home *** CD-ROM | disk | FTP | other *** search
- ;-------------------------sfp2tfp routine begins--------------------------+
- ; ROUTINE FOR CONVERSION FROM SINGLE PRECISION TO TEMPORARY FLOATING POINT
- ;
- ; from BLUEBOOK OF ASSEMBLY ROUTINES FOR IBM PC & XT.
- ; page : 93
- ;
- ; NAME SFP2TFP
- ;
- ; FUNCTION: This routine converts from single precision binary floating point
- ; to temporary binary floating point.
- ;
- ; INPUT: Upon entry a number is stored in single precision binary floating
- ; point form in SFPBUFF. The single precision binary floating point number
- ; has a 24-bit binary mantissa, a sign bit, and an 8-bit exponent biased by
- ; 128 (See fig 5-3).
- ;
- ; OUTPUT: Upon exit a temporary binary floating point number is stored in
- ; FPTEMP1. The temporary binary floating point number has a 72-bit binary
- ; mantissa with 8 bits to the left of those for internal use, a sign byte,
- ; and an 16-bit two's complement exponent (See fig 5-2).
- ;
- ; REGISTERS USED: AX is modified.
- ;
- ; SEGMENTS REFERENCED: Upon entry the data segment must contain the
- ; storage for the temporary binary floating point number FPTEMP1 and the
- ; temporary binary floating point number SFPBUFF.
- ;
- ; ROUTINES CALLED: None
- ;
- ; SPECIAL NOTES: Equates are used to shorten address fields. This is a
- ; near procedure needed by FPOUT. Include the file FPCEQU_S at assembly.
- ;
- ; ROUTINE TO CONVERT FROM SINGLE PRECISION FLOATING POINT TO
- ; TEMP FLOATING POINT
- ;
- sfp2tfp proc near
- ;
- ; clear lower part of mantissa
- mov fptemp1w0,0 ; clear word
- mov fptemp1w2,0 ; clear word
- mov fptemp1w4,0 ; clear word
- ;
- ; move rest of mantissa
- mov ax,sfpbuffw0 ; low two bytes
- mov fptemp1w6,ax ; put in place
- ;
- mov ax,sfpbuffw2 ; 7 hi bits
- and ax,07Fh ; remove sign
- or ax,0080h ; restore msb
- mov fptemp1w8,ax ; put in place
- ;
- ; move sign
- mov al,sfpbuffb2 ; in upper byte
- and al,80h ; just sign bit
- mov fptemp1b10,al ; byte 10 of fptemp1
- ;
- ;
- ; move exponent
- mov al,sfpbuffb3 ; byte three of sfp
- mov ah,0 ; make into a word
- sub ax,80h ; remove bias
- mov fptemp1w11,ax ; it's 16-bit 2's complement
- ;
- ret ; return
- ;
- sfp2tfp endp
- ;-------------------------sfp2tfp routine ends---------------------------+
-